const fs = require('fs');
const path = require('path');
const readFile = path.resolve( __dirname,'gongzi.txt');
const writeFile = path.resolve(__dirname, 'gongzi.bak.txt');
fs.readFile(readFile,'utf8',(err, data) => {
    if(err){
        console.log(err)
    }else{
        fs.writeFile(writeFile,data,'utf8',(e) => {
            if(e){
                console.log(e)
            }else {
                console.log('备份成功!!')
            }
        })
    }

});